package com.zone.sdk_api;

import com.zone.sdk.common.http.base.BaseRequest;
import com.zone.sdk.common.http.callback.ResultCallBack;
import com.zone.vehicle.sdk.module.superapp.SuperAppManager;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppListRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppsDetailRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppsDownloadQueueRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppsDownloadRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppsSyncAbilityListRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppsUpdateListRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.AppsUploadRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.RecommendListRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.SyncStatusRequest;
import com.zone.vehicle.sdk.module.superapp.cloud.request.UserRequest;

public class ApiManager {

    private static ApiManager apiManager;

    private static SuperAppManager superAppManager;

    public static ApiManager getInstance() {
        if (apiManager == null){
            throw new NullPointerException("sdk need init first!");
        }
        return apiManager;
    }

    public static ApiManager init(String appKey, String secret, String url){
        if (apiManager != null){
            apiManager = new ApiManager(appKey, secret, url);
        }
        return apiManager;
    }

    private ApiManager(String appKey, String secret, String url){
        superAppManager = SuperAppManager.getInstance(appKey, secret, url);

    }

    public static void appList(AppListRequest request, ResultCallBack<Void> callback){
        superAppManager.appList(request, callback);
    }

    /**
     * 应用状态同步
     *
     *
     */
    public static void syncStatus(SyncStatusRequest request, ResultCallBack<Void> callback){
        superAppManager.syncStatus(request, callback);
    }

    /**
     * 应用更新列表查询
     *
     *
     */
    public static void appsUpdateList(AppsUpdateListRequest request, ResultCallBack<Void> callback){
        superAppManager.appsUpdateList(request, callback);
    }

    /**
     * 获取活动内容
     *
     *
     */
    public static void recommendList(RecommendListRequest request, ResultCallBack<Void> callback){
        superAppManager.recommendList(request, callback);
    }

    /**
     * 应用详情
     *
     *
     */
    public static void appsDetail(AppsDetailRequest request, ResultCallBack<Void> callback){
        superAppManager.appsDetail(request, callback);
    }

    /**
     * 用户信息查询
     *
     *
     */
    public static void user(UserRequest request, ResultCallBack<Void> callback){
        superAppManager.user(request, callback);
    }

    /**
     * 应用更新列表查询
     *
     *
     */
    public static void appsDownload(AppsDownloadRequest request, ResultCallBack<Void> callback){
        superAppManager.appsDownload(request, callback);
    }

    /**
     * 开发者通过此接口将小程序的白名单同步到
     * appStore
     *
     *
     */
    public static void appsSyncAbilityList(AppsSyncAbilityListRequest request, ResultCallBack<Void> callback){
        superAppManager.appsSyncAbilityList(request, callback);
    }

    /**
     * 车机端同步下载队列应用并由云端推送到手机端
     *
     *
     */
    public static void appsDownloadQueue(AppsDownloadQueueRequest request, ResultCallBack<Void> callback){
        superAppManager.appsDownloadQueue(request, callback);
    }

    /**
     * 文件上传（图片）
     *
     *
     */
    public static void appsUpload(AppsUploadRequest request, ResultCallBack<Void> callback){
        superAppManager.appsUpload(request, callback);
    }

    /**
     * 车机端同步下载队列应用并由云端推送到手机端
     *
     *
     */
    public static void appSearch(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.appSearch(request, callback);
    }

    /**
     * 下载用户对app进行评价及安利
     *
     *
     */
    public static void commentEditComment(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentEditComment(request, callback);
    }

    /**
     * 下载用户对app下的用户评论进行回复
     *
     *
     */
    public static void commentEditReply(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentEditReply(request, callback);
    }

    /**
     * 对用户的评论进行点赞
     */
    public static void commentCommentPraise(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentCommentPraise(request, callback);
    }

    /**
     * 用户评论审核不通过，可对当前评论进行修改
     *
     *
     */
    public static void commentInitCommentDetail(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentInitCommentDetail(request, callback);
    }

    /**
     * 用户评论审核不通过，可对当前评论进行修改
     *
     *
     */
    public static void commentUpdateComment(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentUpdateComment(request, callback);
    }

    /**
     * 显示app总体评分和所有用户评价列表
     *
     *
     */
    public static void commentCommentScore(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentCommentScore(request, callback);
    }

    /**
     * 显示app总体评分和所有用户评价列表
     *
     *
     */
    public static void commentCommentList(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentCommentList(request, callback);
    }

    /**
     * 显示app总体评分和所有用户评价列表
     *
     *
     */
    public static void commentCommentDetail(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentCommentDetail(request, callback);
    }

    /**
     * 分页显示安利墙列表
     *
     *
     */
    public static void commentInitAmwayWallList(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentInitAmwayWallList(request, callback);
    }

    /**
     * 用户查看自己评论过的信息列表
     *
     *
     */
    public static void commentUserCommentList(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentUserCommentList(request, callback);
    }

    /**
     * 用户删除自己的评论
     *
     *
     */
    public static void commentDelUserComment(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentDelUserComment(request, callback);
    }

    /**
     * 查询应用下评论数，不包含回复和回复回复
     *
     *
     */
    public static void commentSearchCommentCount(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.commentSearchCommentCount(request, callback);
    }

    /**
     * 用户提交意见反馈
     *
     *
     */
    public static void feedbackFeedbackCommit(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.feedbackFeedbackCommit(request, callback);
    }

    /**
     * 车机端同步下载队列应用并由云端推送到手机端
     * /user/captchacert/exchange/v1
     *
     *
     */
    public static void captchacertExchange(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.captchacertExchange(request, callback);
    }

    /**
     * 手机号+验证码登录/注册/忘记密码流程中，调用此接口获取短信验证码
     *
     *
     */
    public static void loginPhoneCode(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.loginPhoneCode(request, callback);
    }

    /**
     * 手机号+验证码登录/注册/忘记密码流程中，调用此接口获取短信验证码
     * 与获取验证码接口相同，请求参数做区分 loginPhoneCode
     *
     *
     */
    public static void loginPhoneCodeCheck(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.loginPhoneCode(request, callback);
    }

    /**
     * 手机号+密码登录流程中，调用此接口提交登录请求，并获取登录信息
     *
     *
     */
    public static void loginPhonePwd(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.loginPhonePwd(request, callback);
    }

    /**
     * 用户持有有效Access Token 状态下，调用此接口设置密码。
     *
     *
     */
    public static void userPwdModify(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.userPwdModify(request, callback);
    }

    /**
     * 用户持有有效Access Token 状态下，调用此接口获取个人基本信息
     *
     *
     */
    public static void queryUserInfo(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.queryUserInfo(request, callback);
    }

    /**
     * 用户持有有效Access Token 状态下，调用此接口修改个人基本信息。
     *
     *
     */
    public static void updateUserInfo(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.updateUserInfo(request, callback);
    }

    /**
     * 用户持有有效Access Token 状态下，调用此接口退出当前账号
     *
     *
     */
    public static void logout(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.logout(request, callback);
    }

    /**
     * 用户Access Token 过期状态下，调用此接口以获取新的Token。
     *
     *
     */
    public static void refreshToken(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.refreshToken(request, callback);
    }

    /**
     * 用户持有有效Access Token 状态下，调用此接口上传文件（移动端用于上传自定义头像）。
     *
     *
     */
    public static void userUpload(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.userUpload(request, callback);
    }

    /**
     * 用户持有有效Access Token 状态下，调用此接口查询当前账户在所有设备上的登录状态
     *
     *
     */
    public static void loginStatus(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.loginStatus(request, callback);
    }

    /**
     * 车机端调用此接口生成登录二维码，返回的是QR Code URL
     *
     *
     */
    public static void qrLoginCode(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.qrLoginCode(request, callback);
    }

    /**
     * 车机端通过此接口轮询登录状态。
     *
     *
     */
    public static void qrLoginCodeStatus(BaseRequest request, ResultCallBack<Void> callback){
        superAppManager.qrLoginCodeStatus(request, callback);
    }

}
